<template>
  <div id="app">
    <header class="header">
      <div class="header-left">
        <router-link to="/favorites" class="logo">🦥 懒熊文档</router-link>
      </div>
      <div class="header-right">
        <router-link 
          v-if="route.name === 'Favorites'" 
          to="/" 
          class="nav-btn"
        >
          📄 文档列表
        </router-link>
        <router-link 
          v-if="route.name === 'Document'" 
          to="/favorites" 
          class="nav-btn"
        >
          ❤️ 我的收藏
        </router-link>
        <ThemeToggle />
      </div>
    </header>
    
    <main class="main">
      <router-view />
    </main>
    
  </div>
</template>

<script setup lang="ts">
import { useRoute } from 'vue-router'
import ThemeToggle from './components/ThemeToggle.vue'

const route = useRoute()
</script>

<style scoped>
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: linear-gradient(135deg, #42b883, #35495e);
  color: white;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.header-left .logo {
  margin: 0;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  text-decoration: none;
  color: inherit;
}

.header-left .logo:hover {
  transform: scale(1.05);
  opacity: 0.8;
  color: inherit;
  text-decoration: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
  text-decoration: none;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 768px) {
  .header {
    padding: 0.8rem;
    flex-direction: column;
    gap: 0.8rem;
    text-align: center;
  }
  
  .header-left .logo {
    font-size: 1.5rem;
  }
}
</style>